package com.sc.mapper;

import com.sc.pojo.Notice;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface NoticeMapper {
    //查询所有公告
    @Select("select * from notice;")
    List<Notice> selectAllNotice();
    //根据场地号查询所有公告
    @Select("select * from notice where fieldid = #{fieldid};")
    List<Notice> selectNoticeByFieldId(int fieldid);
    //删除公告信息
    @Delete("delete from notice where noticeid = #{noticeid};")
    void deleteNoticeById(int noticeid);
    
    //添加公告信息
    @Insert("insert into notice (adminname,title,publishtime,information,fieldid)" +
            " values (#{adminname},#{title},#{publishtime},#{information},#{fieldid});")
    void addNotice(Notice notice);
}
